<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
include("settings.php");

class gallery extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/gallery
	 *	- or -  
	 * 		http://example.com/index.php/gallery/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/gallery/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
     
     private function get_collections ()
    {
        $collDB = $this->tdatabase->get_entry('collections');
        $collHTML = "";
        $names = array();
        foreach ($collDB as $coll) {
            $data['collection'] = $coll;
            $names[] = $coll->title;
            $collHTML .= $this->smarty->fetch('collection/collectionBox.tpl', $data);
        }
        $res['html'] = $collHTML;
        $res['names'] = $names;
        return $res;
    } 
    
    private function get_latests_db()
    {
        return $this->images->getLatestImagesHTMLBox(8);
    }
    
	public function index()
	{

	}
    
    public function collection($id)
    {
        $data['img'] = $this->images->get($id);
		$data['collections'] = $this->info->collections;
        $data['phone'] = $this->info->phone_number;
		$data['latests'] = $this->info->latest_images;
        $this->parser->parse("gallery.tpl", $data);
    }

	public function __construct()
	{
		parent::__construct();
		$this->load->database();
		$this->load->model('tdatabase_model', 'tdatabase');
        $this->load->model('images_model', 'images');        
        $this->load->model('info_model', 'info');
	}

}

/* End of file gallery.php */
/* Location: ./application/controllers/gallery.php */
